package info.unclewang.bert.support.dataObject;

import javax.persistence.*;
import java.util.Objects;
import java.util.StringJoiner;

@Entity
@Table(name = "citations", schema = "citations")
public class CitationsDO {
	private Long id;
	private String doi;
	private String citingTitle;
	private String citingAbstract;
	private String structure;
	private String citingSentence;
	private String citedTitle;
	private String citedAuthor;
	private Integer citedYear;
	private String summary;
	private Long cid;

	@Basic
	@Column(name = "id")
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Basic
	@Column(name = "doi")
	public String getDoi() {
		return doi;
	}

	public void setDoi(String doi) {
		this.doi = doi;
	}

	@Basic
	@Column(name = "citing_title")
	public String getCitingTitle() {
		return citingTitle;
	}

	public void setCitingTitle(String citingTitle) {
		this.citingTitle = citingTitle;
	}

	@Basic
	@Column(name = "citing_abstract")
	public String getCitingAbstract() {
		return citingAbstract;
	}

	public void setCitingAbstract(String citingAbstract) {
		this.citingAbstract = citingAbstract;
	}

	@Basic
	@Column(name = "structure")
	public String getStructure() {
		return structure;
	}

	public void setStructure(String structure) {
		this.structure = structure;
	}

	@Basic
	@Column(name = "citing_sentence")
	public String getCitingSentence() {
		return citingSentence;
	}

	public void setCitingSentence(String citingSentence) {
		this.citingSentence = citingSentence;
	}

	@Basic
	@Column(name = "cited_title")
	public String getCitedTitle() {
		return citedTitle;
	}

	public void setCitedTitle(String citedTitle) {
		this.citedTitle = citedTitle;
	}

	@Basic
	@Column(name = "cited_author")
	public String getCitedAuthor() {
		return citedAuthor;
	}

	public void setCitedAuthor(String citedAuthor) {
		this.citedAuthor = citedAuthor;
	}

	@Basic
	@Column(name = "cited_year")
	public Integer getCitedYear() {
		return citedYear;
	}

	public void setCitedYear(Integer citedYear) {
		this.citedYear = citedYear;
	}

	@Basic
	@Column(name = "summary")
	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	@Id
	@Column(name = "cid")
	public long getCid() {
		return cid;
	}

	public void setCid(long cid) {
		this.cid = cid;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		CitationsDO that = (CitationsDO) o;
		return id == that.id &&
				cid == that.cid &&
				Objects.equals(doi, that.doi) &&
				Objects.equals(citingTitle, that.citingTitle) &&
				Objects.equals(citingAbstract, that.citingAbstract) &&
				Objects.equals(structure, that.structure) &&
				Objects.equals(citingSentence, that.citingSentence) &&
				Objects.equals(citedTitle, that.citedTitle) &&
				Objects.equals(citedAuthor, that.citedAuthor) &&
				Objects.equals(citedYear, that.citedYear) &&
				Objects.equals(summary, that.summary);
	}

	@Override
	public int hashCode() {
		return Objects.hash(id, doi, citingTitle, citingAbstract, structure, citingSentence, citedTitle, citedAuthor, citedYear, summary, cid);
	}

	@Override
	public String toString() {
		return new StringJoiner(", ", CitationsDO.class.getSimpleName() + "[", "]")
				.add("id=" + id)
				.add("doi='" + doi + "'")
				.add("citingTitle='" + citingTitle + "'")
				.add("citingAbstract='" + citingAbstract + "'")
				.add("structure='" + structure + "'")
				.add("citingSentence='" + citingSentence + "'")
				.add("citedTitle='" + citedTitle + "'")
				.add("citedAuthor='" + citedAuthor + "'")
				.add("citedYear=" + citedYear)
				.add("summary='" + summary + "'")
				.add("cid=" + cid)
				.toString();
	}
}
